﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubServicosCarrinho.aspx.cs" Inherits="NewTierra.Pages.Operacoes.SubServicosCarrinho" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <link rel="shortcut icon" href="../../images/Icones/favicon.ico" type="image/x-icon" />

    <link href="../../Styles/jquery_notification.css" rel="stylesheet" />

    <link href="../../Styles/jquery-ui.css" rel="stylesheet" />    
    <script type="text/javascript" src="../../Scripts/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-ui-1.10.0.js"></script>

    <script type="text/javascript" src="../../Scripts/jquery_notification_v.1.js"></script>

    <link href="../../Styles/EstiloGeral.css" rel="stylesheet" />

    <title></title>

    <style type="text/css">
        #SubServicos
        {
            height: 540px;
            width: 1135px;
            padding: 10px;
        }

            #SubServicos .dir
            {
                height: 508px;
                width: 727px;
                float: left;
            }

            #SubServicos .esq
            {
                height: 394px;
                width: 373px;
                float: left;
            }

        .esq .gridSubServicos
        {
            float: left;
            overflow-x: hidden;
            overflow-y: auto;
            width: 360px;
            height: 309px;
        }

        .DropSuppliers
        {
            width: 397px;
            height: 43px;
        }

        .middle
        {
            height: 485px;
            padding: 5px;
            display: inline;
            float: left;
            position: relative;
            border: 1px solid #E6E6E6;
            background: #FAFAFA;
            color: #666;
            margin-top: 0px;
            width: 703px;
            top: 0px;
            left: 0px;
        }

        .GridAddSubServicos
        {
            height: 430px;
            overflow-x: auto;
            overflow-y: auto;
        }
    </style>

</head>
<body>

    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManagerServico" runat="server">
        </asp:ScriptManager>

        <script type="text/javascript">

            function ShowIcon() {
                var e = document.getElementById("processing");
                e.style.visibility = (e.style.visibility == 'visible') ? 'hidden' : 'visible';
            }

            function ShowIcon2() {
                var e = document.getElementById("processing2");
                e.style.visibility = (e.style.visibility == 'visible') ? 'hidden' : 'visible';
            }

            function CallServerServico() {
                document.getElementById('<%= btnFiltroNomeSupplier.ClientID %>').click();
            }

            function showAutoCloseMessage(MsgsExc) {
                showNotification({
                    message: MsgsExc,
                    autoClose: true,
                    type: "success",
                    duration: 3
                });
            }

        </script>

        <div id="SubServicos">

            <asp:UpdatePanel ID="UpdatePanelSubServicos" runat="server">
                <ContentTemplate>

                    <fieldset>
                        <legend>Sub Serviços</legend>

                        <div class="esq">

                            <p class="paragrafo">
                                <asp:Label ID="lblValorTXT" runat="server" Text="Valor Total:" /><br />
                                <asp:TextBox ID="txtValorTotal" runat="server" Text="" MaxLength="15" />
                            </p>

                            <asp:Label ID="lblMsgErro" runat="server" Text="" CssClass="MsgErro" />

                            <div class="gridSubServicos">

                                <asp:GridView ID="GridSubServPorTemporada" runat="server"
                                    AutoGenerateColumns="False" GridLines="None" CssClass="mGrid"
                                    Height="16px"
                                    Width="94px">
                                    <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
                                    <Columns>

                                        <asp:BoundField DataField="ServicoCompletoFile_id" HeaderText="">
                                            <ItemStyle CssClass="invisible" />
                                            <FooterStyle CssClass="invisible" />
                                            <HeaderStyle CssClass="invisible" />
                                        </asp:BoundField>

                                        <asp:TemplateField HeaderText="Serviço">
                                            <ItemTemplate>
                                                <span style="font-weight: bold"><%# DataBinder.Eval(Container.DataItem, "ItemSubServico_nome") %></span>- 
                                                <%# DataBinder.Eval(Container.DataItem, "SubItem_nome") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Nome Fantasia">
                                            <ItemTemplate>
                                                <%# Limit(DataBinder.Eval(Container.DataItem, "S_nome"), 15) %>
                                                <br />
                                                <asp:Label ID="lblIdSupplier" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "S_id") %>' Visible="false" />                                                
                                            </ItemTemplate>
                                            <HeaderStyle Wrap="False" />
                                            <ItemStyle Wrap="False" />
                                        </asp:TemplateField>

                                        <%--<asp:BoundField DataField="S_nome" HeaderText="Supplier">
                                            <ItemStyle Wrap="False" />
                                        </asp:BoundField>--%>

                                        <asp:BoundField DataField="Paxs" HeaderText="Paxs" />

                                        <asp:TemplateField HeaderText="Valor">
                                            <ItemTemplate>                                                
                                                <asp:TextBox ID="txtValorSubServico" runat="server" Text='<%# Eval("Valor") %>' Width="50" />                                                
                                            </ItemTemplate>
                                            <HeaderStyle Wrap="False" />
                                            <ItemStyle Wrap="False" />
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <ItemTemplate>

                                                <asp:ImageButton ID="imgAtualizaTarifaSubServico" runat="server" ImageUrl="~/images/Icones/refresh-icon.png"
                                                    OnCommand="imgAtualizaTarifaSubServico_Command" CommandArgument='<%# Eval("ServicoCompletoFile_id") %>' />

                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton ID="ExluirSubServico" ToolTip="Excluir"
                                                    runat="server" CommandArgument='<%# Eval("ServicoCompletoFile_id") %>'
                                                    OnCommand="ExluirSubServico"
                                                    ImageUrl="~/images/Icones/delete.png" />

                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>

                                    </Columns>
                                    <PagerStyle CssClass="pgr"></PagerStyle>
                                </asp:GridView>

                            </div>

                        </div>

                        <div class="dir">

                            <div class="middle radius">

                                <div class="DropSuppliers">

                                    <asp:Label ID="lblSupplierMServicoTXT" runat="server" Text="Supplier:"></asp:Label><br />
                                    <asp:TextBox ID="txtSupplier" runat="server" MaxLength="50" placeholder="Informe o nome do supplier." Width="340px"></asp:TextBox>

                                    <asp:AutoCompleteExtender
                                        ID="AutoCompleteExtenderSupplier"
                                        runat="server" CompletionInterval="100"
                                        DelimiterCharacters="" EnableCaching="False"
                                        Enabled="True" MinimumPrefixLength="1" OnClientItemSelected="CallServerServico"
                                        OnClientPopulated="ShowIcon2" OnClientPopulating="ShowIcon2"
                                        ServiceMethod="SearchSuppliers" ServicePath="" TargetControlID="txtSupplier">
                                    </asp:AutoCompleteExtender>

                                    <img id="processing2" alt="load" src="../../images/ajax-loader.gif" style="visibility: hidden" />
                                    <asp:Button ID="btnFiltroNomeSupplier" runat="server" OnClick="btnFiltroNomeSupplier_Click" Style="display: none"></asp:Button>


                                </div>

                                <div class="GridAddSubServicos">

                                    <asp:GridView ID="GridMServicos" runat="server"
                                        AutoGenerateColumns="False" GridLines="None" CssClass="mGrid" EmptyDataText="Não existe Serviços para esse Supplier."
                                        Height="57px"
                                        Width="373px">
                                        <AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
                                        <Columns>

                                            <asp:BoundField DataField="IdMServico" HeaderText="ID" ReadOnly="True"
                                                SortExpression="IdMServico" InsertVisible="False">
                                                <FooterStyle CssClass="invisible" />
                                                <HeaderStyle CssClass="invisible" />
                                                <ItemStyle CssClass="invisible" />
                                            </asp:BoundField>

                                            <asp:BoundField DataField="MServico_DataFrom" HeaderText="Data To" DataFormatString="{0:dd/MM/yyyy}" />

                                            <asp:BoundField DataField="MServico_DataTo" HeaderText="Data To" DataFormatString="{0:dd/MM/yyyy}" />

                                            <asp:BoundField DataField="ItemSubServico" HeaderText="Item SubServiço">

                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Wrap="False" HorizontalAlign="Center" />
                                            </asp:BoundField>

                                            <asp:BoundField DataField="SubItem" HeaderText="Sub Item">

                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Wrap="False" HorizontalAlign="Center" />
                                            </asp:BoundField>

                                            <asp:BoundField DataField="Moeda_sigla" HeaderText="Moeda">
                                                <ItemStyle HorizontalAlign="Center" />
                                            </asp:BoundField>

                                            <asp:BoundField DataField="MServico_Obs" HeaderText="Obs" />

                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="EditarMServico" ToolTip="Adicionar Sub Serviço"
                                                        runat="server" ImageUrl="~/images/plus-small.png"
                                                        CommandArgument='<%# Eval("IdMServico") %>'
                                                        OnCommand="EditarMServico" />
                                                </ItemTemplate>
                                                <HeaderStyle Wrap="False" />
                                                <ItemStyle Wrap="False" />
                                            </asp:TemplateField>


                                        </Columns>

                                        <PagerStyle CssClass="pgr"></PagerStyle>

                                    </asp:GridView>

                                </div>

                            </div>
                        </div>

                    </fieldset>

                </ContentTemplate>
            </asp:UpdatePanel>

            <div id="UpdateProgress"
                style="position: absolute; z-index: 1; left: 50%; top: 50%;">
                <asp:UpdateProgress ID="preLoading" runat="server"
                    AssociatedUpdatePanelID="">
                    <ProgressTemplate>

                        <asp:Image ID="imgLoading" runat="server"
                            ImageUrl="~/Images/ajax-loaderG.gif" />

                    </ProgressTemplate>
                </asp:UpdateProgress>
            </div>

        </div>

    </form>

</body>
</html>
